package com.example.animation;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textView = findViewById(R.id.textView);
    }

    public void alpha(View view){ // 透明度变化
        Animation anim = AnimationUtils.loadAnimation(this,R.anim.alpha);
        textView.startAnimation(anim);

    }

    public void rotate(View view){ // 旋转动画
        Animation anim = AnimationUtils.loadAnimation(this,R.anim.rotate);
        textView.startAnimation(anim);
    }

    public void scale(View view){ // 缩放动画
        Animation anim = AnimationUtils.loadAnimation(this,R.anim.scale);
        textView.startAnimation(anim);
    }

    public void translate(View view){ // 平移动画
        Animation anim = AnimationUtils.loadAnimation(this,R.anim.translate);
        textView.startAnimation(anim);
    }
}
